package com.gzyj.video.common;

import io.netty.channel.Channel;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public final class SessionManager {
    private static final Map<String, Object> mappings = new ConcurrentHashMap<>();

    public static void init() {
        // ...
    }

    public static <T> T get(Channel channel, String key) {
        return (T) mappings.get(channel.id().asLongText() + key);
    }

    public static void set(Channel channel, String key, Object value) {
        mappings.put(channel.id().asLongText() + key, value);
    }

    public static boolean contains(Channel channel, String key) {
        return mappings.containsKey(channel.id().asLongText() + key);
    }
}